package dao.pojo;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.TableGenerator;

import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * TGroup entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "t_group", catalog = "fw", uniqueConstraints = @UniqueConstraint(columnNames = "GroupName"))
public class Group extends BasePojo implements java.io.Serializable {

	// Fields

	private Integer groupId;
	private String groupName;
	private String remarks;
	private String loginUrl;
	private Set<GroupMember> groupMembers = new HashSet<GroupMember>(0);
	private Set<GroupMenu> groupMenus = new HashSet<GroupMenu>(0);
	private Set<GroupAuthority> groupAuthorities = new HashSet<GroupAuthority>(
			0);

	// Constructors

	/** default constructor */
	public Group() {
	}

	/** minimal constructor */
	public Group(String groupName) {
		this.groupName = groupName;
	}


	// Property accessors
	@Id
	@TableGenerator(name = "GROUP_GEN", table = "sequence", pkColumnName = "SEQ_NAME", valueColumnName = "SEQ_COUNT", pkColumnValue = "SEQ_GROUP", allocationSize = 1)
	@GeneratedValue(strategy = GenerationType.TABLE, generator = "GROUP_GEN")
	//@GeneratedValue(strategy = IDENTITY)
	@Column(name = "groupid", unique = true, nullable = false)
	public Integer getGroupId() {
		return this.groupId;
	}

	public void setGroupId(Integer groupId) {
		this.groupId = groupId;
	}

	@Column(name = "GroupName", unique = true, nullable = false, length = 50)
	public String getGroupName() {
		return this.groupName;
	}

	public void setGroupName(String groupName) {
		this.groupName = groupName;
	}
	
	@Column(name = "loginUrl", length = 200)
	public String getLoginUrl() {
		return loginUrl;
	}

	public void setLoginUrl(String loginUrl) {
		this.loginUrl = loginUrl;
	}

	@Column(name = "Remarks", length = 100)
	public String getRemarks() {
		return this.remarks;
	}

	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "group")
	public Set<GroupMember> getGroupMembers() {
		return this.groupMembers;
	}

	public void setGroupMembers(Set<GroupMember> groupmembers) {
		this.groupMembers = groupmembers;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "group")
	public Set<GroupMenu> getGroupMenus() {
		return this.groupMenus;
	}

	public void setGroupMenus(Set<GroupMenu> groupMenus) {
		this.groupMenus = groupMenus;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "group")
	public Set<GroupAuthority> getGroupAuthorities() {
		return this.groupAuthorities;
	}

	public void setGroupAuthorities(Set<GroupAuthority> groupAuthorities) {
		this.groupAuthorities = groupAuthorities;
	}
	
	public Object getEntityId(){
		return this.groupId;
	}

}